* Cross-sectional Analysis Kaplan-Meier.sps.
* Restricted to teeth retreated with fillings, crowns/inlays or extractions.
* Written by PSKL on 27/5/02.
* Create File of all tooth treated records after 31/3/2000 with date of acceptance before May 2001.
get file='D:\Longitudinal Data\dob1965acc199904to200104 teeth.sav'.
* estimate date of placing of treatment.
compute doplac=doacc.
if (not(missing(docomp)))doplac=docomp.
* Restrict analysis to date of completion/acceptance after 31/3/2000 and date of acceptance before May 2001.
select if (doplac>yrmoda(2000,03,31)*60*60*24
and doacc<yrmoda(2001,05,01)*60*60*24).
formats doplac (edate10).
save outfile='c:\temp1.sav'.
* Reduce to records of teeth treated with fillings, crowns/inlays or extractions from April 2000 to April 2001.
get file='c:\temp1.sav'.
select if (any(trtcode,1401,1402,1403,1404,1421,1426)
or range(trtcode,1701,1799) or range(trtcode,2101,2299)).
* Reduce to one record per tooth per course of treatment, by using lowest trtcode.
sort cases by surname initial sex dobirth doacc quadrant tooth trtcode.
aggregate outfile=* /presorted
/break surname initial sex dobirth doacc quadrant tooth
/ doplac docomp dorec schednum fpcnum persnum partnum suffix postcode exempcod trtcode
=first(doplac docomp dorec schednum fpcnum persnum partnum suffix postcode exempcod trtcode).
compute retreat=1.
if (any(trtcode,1401,1402,1403,1404,1421,1426))retreat=0.
* sort in descending order of date of acceptance.
sort cases by surname initial sex dobirth quadrant tooth (a) doacc(d) .
save outfile='c:\temp2.sav'.
* Add date of retreatment, if any, to filling records, then get rid of non-filling records.
* Flag all filling courses followed by crown, extraction or bridge.
get file='c:\temp2.sav'.
if(retreat=0 and
surname = lag(surname) and
initial = lag(initial) and
sex = lag(sex) and
dobirth = lag(dobirth) and
quadrant = lag(quadrant) and
tooth = lag(tooth)) doretr=lag(doacc).
if (not(missing(doretr)) and lag(retreat)=1)doloss=doretr.
formats doplac doretr doloss (EDATE10).
execute.
select if (retreat=0).
* sort to save processing time later.
sort cases by surname initial sex dobirth quadrant tooth doplac trtcode.
save outfile='c:\temp3.sav'.
* At this stage we have a record for each tooth treatment record. * If the tooth was retreated then doretr is not missing. * Create time and reintervention variables and assume censoring on 30/4/2001, or after 365 days * whichever is earlier.Ignore cases with doplac>30/4/2001. get file='c:\temp3.sav'. select if (doplac<date.dmy(31,4,2001)). compute reint=0. compute time=ctime.days(doretr-doplac). if (range(time,1,365))reint=1. if (reint=0) time=min(ctime.days(date.dmy(31,4,2001)-doplac),365). * Kaplan-Meier Survivor Functions. SET MXMEMORY=50000. KM time BY trtcode /STATUS=reint(1) /PRINT NONE /TEST = LOGRANK /COMPARE = PAIRWISE /save Survival(survtrt).
| Output Created | 27-MAY-2002 17:45:59 | |
|---|---|---|
| Comments | ||
| Input | Data | c:\temp3.sav |
| Filter | <none> | |
| Weight | <none> | |
| Split File | <none> | |
| N of Rows in Working Data File | 364124 | |
| Syntax | KM time BY trtcode /STATUS=reint(1) /PRINT NONE /TEST = LOGRANK /COMPARE = PAIRWISE /save Survival(survtrt). |
|
| Resources | Elapsed Time | 0:01:38.26 |
Survival Analysis for TIME
Total Number Number Percent
Events Censored Censored
TRTCODE 1401 52771 1764 51007 96.66
TRTCODE 1402 11693 568 11125 95.14
TRTCODE 1403 128057 6782 121275 94.70
TRTCODE 1404 44335 3114 41221 92.98
TRTCODE 1421 92845 5608 87237 93.96
TRTCODE 1426 34423 3037 31386 91.18
Overall 364124 20873 343251 94.27
Log Rank Statistic and (Significance)
Factor 1401 1402 1403 1404 1421
1402 67.09
( .0000)
1403 333.21 4.35
( .0000) ( .0370)
1404 722.16 73.33 190.03
( .0000) ( .0000) ( .0000)
1421 535.91 27.34 58.86 50.78
( .0000) ( .0000) ( .0000) ( .0000)
1426 1257.53 192.50 608.98 85.33 310.39
( .0000) ( .0000) ( .0000) ( .0000) ( .0000)
select if (reint=1). sort cases by time trtcode. aggregate outfile=* /presorted /break time trtcode /survtrt=first(survtrt) /n=n. If (trtcode=1401) TRT1401=survtrt. If (trtcode=1402) TRT1402=survtrt. If (trtcode=1403) TRT1403=survtrt. If (trtcode=1404) TRT1404=survtrt. If (trtcode=1421) TRT1421=survtrt. If (trtcode=1426) TRT1426=survtrt. aggregate outfile=* /presorted /break time / trt1401 trt1402 trt1403 trt1404 trt1421 trt1426 = first(trt1401 trt1402 trt1403 trt1404 trt1421 trt1426). SAVE TRANSLATE OUTFILE='I:\Research Projects\longevity\Cross-section KM.xls' /TYPE=XLS /MAP /REPLACE /FIELDNAMES. Data written to I:\Research Projects\longevity\Cross-section KM.xls. 7 variables and 365 cases written to range: SPSS. Variable: TIME Type: Number Width: 8 Dec: 2 Variable: TRT1401 Type: Number Width: 8 Dec: 2 Variable: TRT1402 Type: Number Width: 8 Dec: 2 Variable: TRT1403 Type: Number Width: 8 Dec: 2 Variable: TRT1404 Type: Number Width: 8 Dec: 2 Variable: TRT1421 Type: Number Width: 8 Dec: 2 Variable: TRT1426 Type: Number Width: 8 Dec: 2